package com.kf5sdk.exam

import com.kf5.sdk.R
import org.junit.Assert
import org.junit.Test

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see [Testing documentation](http://d.android.com/tools/testing)
 */
class ExampleUnitTest {
    @Test
    @Throws(Exception::class)
    fun addition_isCorrect() {
        Assert.assertEquals(4, 2 + 2.toLong())
    }

    @Test
    fun genKF5LibPublicResourceXML() {
        val formater = """
            <public name="%s" type="%s"/>
        """.trimIndent()
        val cls = R::class.java
        val name = cls.name
        cls.classes.forEach { resClass ->
            val fields = resClass.declaredFields
            val type = resClass.simpleName
            fields.forEach {
                if (!it.name.startsWith("kf5_")) println(formater.format(it.name, type))
            }
        }
    }
}